1 using UnityEngine;
2
3 ///
<summary>
4 ///
Sets isKinematic to true, GameObject is owned by a another player (PhotonView.isMine == false).
5 ///
For Rigidbody and Rigidbody2D.
6 ///
</summary>
7 [RequireComponent(
typeof (PhotonView))]
8 public
class OnAwakePhysicsSettings : Photon.MonoBehaviour
9 {
10     
public void Awake()
11     {
12         
if (!photonView.isMine)
13         {
14             Rigidbody attachedRigidbody = GetComponent<Rigidbody>();
15             
if (attachedRigidbody != null)
16             {
17                 attachedRigidbody.isKinematic =
true;
18             }
19             
else
20             {
21                 Rigidbody2D attachedRigidbody2d = GetComponent<Rigidbody2D>();
22                 
if (attachedRigidbody2d != null)
23                 {
24                     attachedRigidbody2d.isKinematic =
true;
25                 }
26             }
27         }
28     }
29 }


Sets isKinematic to true, GameObject is owned by a another player (PhotonView.isMine == false).

For Rigidbody and Rigidbody2D.




Trò chơi Tic-Tac-Toe, game đánh caro full source code 53.577 lượt xem

Gõ tìm kiếm nhanh...